package cn.bossx.org.service.impl;

import cn.bossx.basic.service.impl.BaseServiceImpl;
import cn.bossx.org.domain.SystemDictionaryType;
import cn.bossx.org.mapper.SystemDictionaryDetailMapper;
import cn.bossx.org.mapper.SystemDictionaryTypeMapper;
import cn.bossx.org.service.ISystemDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SystemDictionaryTypeServiceImpl extends BaseServiceImpl<SystemDictionaryType> implements ISystemDictionaryTypeService {

    @Autowired
    private SystemDictionaryTypeMapper systemDictionaryTypeMapper;

    @Autowired
    private SystemDictionaryDetailMapper systemDictionaryDetailMapper;

    @Override
    @Transactional
    public void remove(Long id) {
        systemDictionaryDetailMapper.delByTypeId(id);
        systemDictionaryTypeMapper.delete(id);
    }

    @Override
    @Transactional
    public void batchRemove(List<Long> ids) {
        systemDictionaryDetailMapper.patchDelByTypeId(ids);
        systemDictionaryTypeMapper.batchRemove(ids);
    }
}
